package com.tarena.lbs.business.controller;

import com.tarena.lbs.base.protocol.model.Result;
import com.tarena.lbs.business.config.ResultUtil;
import com.tarena.lbs.business.pojo.vo.BusinessCategoryVO;
import com.tarena.lbs.business.service.BusinessCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@Api(tags = "商家分类相关功能接口")
@RestController
public class BusinessCategoryController {
    @Autowired
    BusinessCategoryService businessCategoryService;


    @ApiOperation(value = "查询所有分类")
    @GetMapping("/admin/basic/business/category/list/")
    public Result<List<BusinessCategoryVO>> allCategories(){
        log.info("接收到查询所有商家分类请求");
        List<BusinessCategoryVO> list = businessCategoryService.allCategories();
        log.info("成功查询到 {} 条商家分类", list.size());
        return ResultUtil.success(list);
    }

}
